<template>
  <div class="w-full h-full flex flex-col">
    <div class="w-full flex h-10 items-center text-[--textColor] border-b mb-3">
      <span class="ml-5">复杂表格封装</span>
    </div>
    <div class="w-full flex-1 px-5 pb-5 box-border overflow-y-auto">
      <el-table
        :data="tableData"
        border
        height="100%"
        v-loading="loading"
        stripe
        highlight-current-row
        empty-text='暂无数据'
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column prop="sort" label="序号" width="60" align="center" />
        <el-table-column
          prop="clusterName"
          label="涉及组团"
          min-width="10"
          align="center"
        />
        <el-table-column
          prop="buildingName"
          label="涉及楼栋"
          min-width="10"
          align="center"
        />
        <el-table-column
          prop="statusDescription"
          label="项目形象进度"
          min-width="10"
          align="center"
        />
        <el-table-column
          label="专业工程名称"
          min-width="10"
          align="center"
          class-name="all"
        >
          <template #default="scope">
            <div class="">
              <p
                class="boxtt w-full leading-[40px] border-t h-[40px]"
                v-for="(item, index) in scope.row.constructionProjectList"
                :key="index"
              >
                <span>{{ item.itemName }}</span>
              </p>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="剩余未施工面积(m2)" min-width="11" align="center">
          <template #default="scope">
            <div class="">
              <p
                class="boxtt w-full leading-[40px] border-t h-[40px]"
                v-for="(item, index) in scope.row.constructionProjectList"
                :key="index"
              >
                <span>{{ item.remainUnconArea }}</span>
              </p>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="单方造价（元/m2）" min-width="11" align="center">
          <template #default="scope">
            <div class="">
              <p
                class="boxtt w-full leading-[40px] border-t h-[40px]"
                v-for="(item, index) in scope.row.constructionProjectList"
                :key="index"
              >
                <span>{{ item.unitCost }}</span>
              </p>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="剩余产值（万元）" min-width="10" align="center">
          <template #default="scope">
            <div class="">
              <p
                class="boxtt w-full leading-[40px] border-t h-[40px]"
                v-for="(item, index) in scope.row.constructionProjectList"
                :key="index"
              >
                <span>{{ item.remainOutputValue }}</span>
              </p>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          prop="createByName"
          label="创建人"
          min-width="10"
          align="center"
        />
        <el-table-column prop="createTm" label="创建时间" min-width="10" align="center" />
        <el-table-column label="操作" min-width="12" align="center">
          <template #default="{ row }">
            <el-button link>编辑</el-button>
            <el-button class="text-[red]" link>删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage } from "element-plus";

export default defineComponent({
  setup() {
    const state=reactive({
        tableData:[
            {
                sort:'1',
                clusterName:'组团1',
                buildingName:'楼栋1',
                statusDescription:'组团111',
                constructionProjectList:[
                    {itemName:'11',remainUnconArea:'11',unitCost:'111',remainOutputValue:'111'},
                    {itemName:'11',remainUnconArea:'11',unitCost:'111',remainOutputValue:'111'},
                    {itemName:'11',remainUnconArea:'11',unitCost:'111',remainOutputValue:'111'},
                    {itemName:'11',remainUnconArea:'11',unitCost:'111',remainOutputValue:'111'},
                ],
                createByName:'开发者-廖',
                createTm:'2023-08-30 10:14:22',
            },
        ],
        loading:false,
        multipleSelection:[],
        handleSelectionChange:(val:any)=>{
            state.multipleSelection = val;
        },
    })
    return {
        ...toRefs(state)
    };
  },
});
</script>

<style lang='scss' scoped>
:deep(.cell) {
  padding: 0 0px;
}
.boxtt:nth-child(1) {
  border: none;
}
:deep(.all) {
  padding: 0px !important;
}
</style>
